@import "@wordpress/base-styles/colors.native";
@import "@wordpress/base-styles/breakpoints";
@import "@wordpress/base-styles/mixins";

.related-plugins {
	margin-top: 48px;
	margin-bottom: 32px;
}

.related-plugins__header {
	display: flex;
	flex-direction: row;
	line-height: 40px;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 32px;

	h2 {
		font-family: $brand-serif;
		font-size: $font-title-large;
		overflow-wrap: anywhere;
		color: $gray-100;
	}
	.full-width-section & {
		margin-bottom: 0;

		h2 {
			font-size: rem(40px);
		}
	}
}

.related-plugins__list {
	display: grid;
	grid-template-columns: repeat(2, calc(50% - 12px));
	column-gap: 24px;
	row-gap: 32px;

	.related-plugins-item {
		text-decoration: none;
	}

	.related-plugins-item__icon {
		float: left;
		margin-right: 16px;
		width: 70px;
		height: 70px;
	}

	.related-plugins-item__info,
	.related-plugins-item__excerpt,
	.related-plugins-item__title {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.related-plugins-item__info {
		color: $gray-60;
		font-family: var(--font-sf-pro-text);
		font-size: $font-body-small;
		line-height: 20px;
	}

	.related-plugins-item__title {
		color: $gray-100;
		font-weight: 500;
		font-size: $font-body;
		line-height: 24px;
	}

	.related-plugins-item__excerpt {
		color: $gray-60;
	}
	.full-width-section & {
		.related-plugins-item__title {
			font-size: $font-body-small;
			line-height: 1.5;
		}
		.related-plugins-item__excerpt {
			font-size: $font-body-extra-small;
		}
	}

	.related-plugins-item__details {
		margin-top: 8px;
		line-height: 18px;
		font-size: $font-body-extra-small;
		color: $gray-70;
	}

	.related-plugins-item__category {
		color: $gray-60;
		text-transform: capitalize;

		&::before {
			color: $gray-20;
			content: "•";
			margin: 0 8px;
		}
	}

	.full-width-section .full-width-section__content & {
		row-gap: 0;

		.related-plugins-item {
			background: var(--studio-white);
			border-radius: 8px;
			padding: 16px;
			margin-top: 24px;
			border: 1px solid transparent;

			&:active, &:hover {
				border-color: var(--studio-blue-50);
			}
		}
	}
}

// Carousel-specific styles (marketplace-redesign flag)
.related-plugins__carousel {
	.dot-pager__controls {
		margin-top: 16px;
		margin-bottom: 0;
	}

	// Match the responsive column layout from .plugins-browser-item.compact
	.related-plugins__list {
		// Mobile: 1 column
		grid-template-columns: 1fr;

		.related-plugins-item {
			margin-top: 16px;
			min-width: 30%;
		}

		@include break-medium {
			// Medium and Large: 2 columns
			grid-template-columns: repeat(2, 1fr);
		}

		@include break-wide {
			// Wide: 3 columns
			grid-template-columns: repeat(3, 1fr);
		}
	}
}
